<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>工作表选择</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			/* $("#btn").click(function(){
				// 基于准备好的dom，初始化echarts实例
		        var myChart = echarts.init(document.getElementById('main'));

		        // 指定图表的配置项和数据
		        var option = {
		            title: {
		                text: 'ECharts 入门示例'
		            },
		            tooltip: {},
		            legend: {
		                data:['销量']
		            },
		            xAxis: {
		                data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
		            },
		            yAxis: {},
		            series: [{
		                name: '销量',
		                type: 'line',
		                data: [5, 20, 36, 10, 10, 20]
		            }]
		        };

		        // 使用刚指定的配置项和数据显示图表。
		        myChart.setOption(option);
			}); */
		});
		function submitForm(){           
			//子窗体页面的保存数据方法 通过ajax
			if($("#inputForm").valid()){
				var tableId = $("#tableId").val();
				var id = $("#id").val();
				var dashboardId = $("#dashboardId").val();
				parent.$.jBox.close(true);
				return "${ctx}/ins/insQuota/newForm?table.id="+tableId+"&id="+id+"&dashboardId="+dashboardId;
			}
			return false;
        }
	</script>
</head>
<body>
	<form:form id="inputForm" modelAttribute="insQuota" action="${ctx}/ins/insQuota/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<input type="hidden" id="dashboardId" value="${insQuota.dashboard.id}"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">工作表：</label>
			<div class="controls">
				<select id="tableId" name="table.id" class="input-xlarge required">
					<option value="">---请选择---</option>
					<c:forEach items="${tables}" var="table">
						<option value="${table.id}" <c:if test="${insQuota.table.id==table.id}">selected</c:if>>${table.name}</option>
					</c:forEach>
				</select>
			</div>
		</div>
		<!-- <div id="main" style="width: 600px;height:400px;"></div> -->
	</form:form>
</body>
</html>